# encoding: utf-8

class Security::Person < ActiveRecord::Base
  has_many :obj_complaint, :class_name => 'RequestAndComplaint::Complaint', :foreign_key => 'complaint'
  has_many :obj_collection, :class_name => 'CulturalHeritage::Collection',  :foreign_key => 'owner'
  has_many :obj_care_and_maintenance, :class_name => 'CulturalHeritage::CareAndMaintenance',  :foreign_key => 'security_person'
  has_many :obj_care_and_maintenance_sup, :class_name => 'CulturalHeritage::CareAndMaintenance',  :foreign_key => 'supervisor'
  belongs_to :obj_user, :class_name => 'CulturalHeritage::Collection',  :foreign_key => 'owner'
  default_scope where("deleted = 0")

  validates :name, :presence => {:message => "El nombre es requerido"}
  validates :lastname, :presence => {:message => "Los apellidos son requeridos"}
  #validates :address, :presence => {:message => "La dirección es requerida"}

end
